--This script must be run from within an entitled publication
--This script creates a new publication,
--enters text for a cookie recipe and then turns
--several non-whole numbers in the recipe into
--correctly-formatted fractions.
--It also enters instructions on how to use "Fraction.script."
-- Begin Script --
--Saves and closes publication
save —saves open publication
close —closes open publication
--Creates a new publication
new 1 —creates a new publication with one page
pagesize 8.5i, 11i -sets page size to letter size
--Sets the margins, turns guides & ruler off, sets the view, and centers the window to the desired position
pagemargins 2i, .75i, 2i, 2i —sets the page margins in inches.
zeropointreset —set the ruler zero point to it’s default position
guides off —hides rule & column guides
rulers off —hides rulers
view 100 —changes layout view to actual size
scroll 4.5i, 3.25i — centers the window on the specified coordinates
redraw on
--Draws boxes
box 1.875i, 1i, 6i, 1.5i — draws a box at the specified coordinates. Left side, top, right side and bottom
fillstyle solid —fill the box with a solid color
color “Blue” —applies the color Blue from the color palette to the box.
deselect —deselects the box
redraw on —refreshes the screen display
box 1.875i, 1.5i, 6i, 3.5i
color “Blue”
linestyle onepoint —sets the line weight of the box to 1 point.
fillstyle none —sets the box fill to none
deselect
redraw on
--Creates a new story and enter the cookie recipe
newstory 2i, 1.25i —Creates a new text block.
--The next command enters the text for the Cookie Recipe
textenter “Chocolate Chip Cookies
2 cups of flour
1-1/2 cups brown sugar
1/2 cup sugar
1 cup butter
2 eggs
1 teaspoon of vanilla
1 teaspoon of baking soda
1 16-ounce bag of chocolate chips”
redraw on
--Changes font to Helvetica and changes the size of both the title and text.
textcursor -story —moves the cursor to the beginning of the story
textselect +eol —selects the text of the first line
size 24 —changes the type size to 24 points
typestyle bold —changes the typestyle to bold
typestyle reverse —reverses the type, changing the selected type’s color to “Paper”
paraspace 0, 0p4 —adds 4 points of space after the selected paragraph
textcursor +char —moves the text cursor 1 character
redraw on
textselect +story —selects text from the text cursor to the end of the story
size 14 —changes the selected type to 14 points
redraw on
selectall —selects the entire story
font “Helvetica” —changes the selected text to “Helvetica”
redraw on
--Moves the cursor into position to format the first fraction
textcursor -story —moves the cursor to the beginning of the story
textcursor +para —moves the text cursor ahead one paragraph
textcursor +eol —moves the text cursor to the end line its on
textcursor +char —moves the text cursor ahead one character
textcursor + word —moves the text cursor ahead one word
textcursor + word
textcursor + word
textcursor + word
textcursor + word
textcursor -char —moves the text cursor back one character
--Formats the first fraction
textselect -word —selects the word to the left of the text cursor
typeoptions 80,58,33,0 —sets the small caps size (80% of normal), Super/subscript size (58% of normal), superscript postion (33% of type size above the baseline), and subscript position (0% or right on the baseline)
position subscript —sets the denominator to specified subscript position
textcursor -char
textselect +char
textenter “⁄” —changes the regular slash ‘/’ to an option-shift-1 slash for better looking fraction
textcursor -char
textselect -word
typeoptions 80,58,33,0
position superscript —sets the numerator to specified superscript position
textcursor +word
textcursor +word
position normal
redraw on
--Positions cursor for formatting second fraction
textcursor +eol
textcursor +char
textcursor + word
textcursor + word
textcursor + word
textcursor -char
--Formats second fraction
textselect -word
typeoptions 80,58,33,0
position subscript
textcursor -char
textselect 0
textenter “⁄”
textcursor -char
textselect -word
typeoptions 80,58,33,0
position superscript
textcursor +word
textcursor +word
position normal
deselect
redraw on
pagemargins .75i, .75i, .75i, .75i —changes the page margins for new text block
newstory 2i, 4i
font “Times”
size 12
paraspace 0p6, 0
textenter “This is an example of the way scripts can be used to automate time-consuming tasks.
One of the tasks automated in this example is the formatting of fractions to enhance their appearance.
A script for formatting fractions has been included with PageMaker 4.2. This script substitutes a non-breaking fraction slash for a standard slash, then changes the numerator to a superscript character and the denominator to a subscript character. To try it insert the text cursor just to the right of the fraction below (do not highlight the fraction), then choose \“Run Script...\” from the \“Aldus Additions\” menu, select \“Fraction.Script,\” and click on the \“Run File\” button.
“
Size 24
alignment center —sets alignment of paragraph to centered